package com.briup.gxqd.controller;

import com.briup.gxqd.utils.Message;
import com.briup.gxqd.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

/**
 * @program: qxqd
 * @description: 患病人群控制器
 * @author: rendc
 * @create: 2020-06-11 16:41
 **/
@RestController
@RequestMapping("distributio")
@Api(description = "患病人群分布数据管理接口")

public class DistributioController {
    //3. 患病人群分布
    @ApiOperation(value = "患病人群分布")
    @GetMapping("findAllDistributio")
    public Message findAllDistributio() {
        StringBuilder json = new StringBuilder();
        try {
            URL urlObject = new URL("https://a.amap.com/Loca/static/mock/bj_heat_grid.js");
            URLConnection uc = urlObject.openConnection();
            BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream(), "UTF-8"));
            String inputLine = null;
            while ((inputLine = in.readLine()) != null) {
                json.append(inputLine);
            }
            in.close();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        ;
        return MessageUtil.success("success", json);
    }
}















